#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <math.h>
#include <string.h>

int main(int argc,char *argv[])
{
    int ret = 0;
    unsigned char bytes[8]={0x40,0x59,0x07,0xae,0x14,0x7a,0xe1,0x58};
    unsigned char rbytes[8];
    unsigned char orig[8];
    double value = 100.0;

    memcpy(orig,&value,8);
    printf("sizeof double = %ld,orig = %x,%x,%x,%x,%x,%x,%x,%x\n",sizeof(double),orig[0],orig[1],
	    orig[2],orig[3],orig[4],orig[5],orig[6],orig[7]);

    memcpy(&value,bytes,8);
    printf("order value = %7.2f\n",value);

    int i = 0;
    for(i=0;i<8;i++)
    {
	rbytes[i] = bytes[7-i];
    }
    memcpy(&value,rbytes,8);
    printf("reverse order value = %7.2f\n",value);

    return ret;
}

